@extends('public.common.common')

@section('title')
博客登录
@endsection

@section('style')
  <link rel="stylesheet" href="/css/login.css">
@endsection
@section('content')
<div class="container bd">
    <div class="row">
      <div class="col-md-6">
          <form action="{{url('/public/login')}}" method="POST">
            <div class="login">
            <p><i class="icon layui-icon layui-icon-triangle-r"></i>登录</p>
            <div class="row my-3">
              <div class="col-md-3">
                <label for="uname">用户名</label>
              </div>
              <div class="col-md-6">
                <input type="text" name="uname" class="@error('uname') is-invalid @enderror mb-2" required autocomplete="off" id="uname" placeholder="用户名">
                @error('uname')
                    <div class="alert alert-danger">{{ $message }}</div>
                @enderror
              </div>
              <span class="col-md-3 umess"></span>
            </div>
            <div class="row my-3">
              <div class="col-md-3">
                <label for="password">密码</label>
              </div>
              <div class="col-md-6">
                <input type="password" class="@error('password') is-invalid @enderror mb-2" name="password" required autocomplete="off"  id="password" placeholder="密码">
                @error('password')
                    <div class="alert alert-danger">{{ $message }}</div>
                @enderror
              </div>
              <span class="col-md-3 pmess"></span>
            </div>
            <div class="row my-3">
              <div class="col-md-3">
                <label for="captcha" >验证码</label>
              </div>
              <div class="col-md-6">
                <input type="text" class=" w-50 pr-3" class="@error('captcha') is-invalid @enderror mb-2" name="captcha"  required autocomplete="off"  id="captcha" placeholder="验证码">
                <img src="{{captcha_src()}}" alt="">
                @error('captcha')
                    <div class="alert alert-danger">{{ $message }}</div>
                @enderror
              </div>
            </div>
            <div class="row my-3">
              <div class="col-md-6 offset-md-2">
                @csrf
                <button type="submit" class="btn btn-primary dosub">登 录</button>
              </div>
            </div>
          </div> 
          </form> 
      </div> 
      <div class="col-md-6">
        <div class="reg shadow-sm bg-light pl-3 py-2">
          <p><i class="icon layui-icon layui-icon-triangle-r"></i>还没有账号</p>
          <a href="{{url('/public/register')}}" class="text-success now border border-success">立即注册</a>
          <span>若<a href="">忘记密码?</a> 可以通过邮箱或手机找回</span>
          <ul>
            <li>期待你的文章</li>
            <li>我们一起分享点滴</li>
            <li>健康生活，更爱你</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
@endsection

@section('script')
$('.dosub').click(function(e) {
  if(!uflag || !pflag ) {
    e.preventDefault();
    return;
  }
})
$('img').click(function() {
  $(this).attr('src','{{url('/captcha/default?')}}'+Date.now()+Math.floor(Math.random()*8999+1000));
})
@if(session('status')) 
layer.alert("{{session('status')}}",{icon:0});
@endif
@endsection